package com.idbk.chargestation.api;

import com.zhy.http.okhttp.callback.Callback;
import com.zhy.http.okhttp.request.RequestCall;

import java.util.HashMap;
import java.util.Map;


/**
 * 用户相关的api
 *
 * @author lupc
 */
public class APIForUser {

    /**
     * 删除第三方充电点采集的 图片
     *
     * @param id         第三方采集充电点的id
     * @param imageIndex 要删除图片的索引（位置，从1开始）
     * @param callback   回调
     */
    public static RequestCall deletePointCollectionImage(
            int id,
            int imageIndex,
            Callback<String> callback) {
        final String URL = ChargeStationURL.format("/other/otherpile!delete.do");

        Map<String, String> params = new HashMap<String, String>();
        params.put("model.id", id + "");
        if (imageIndex == 1) {
            params.put("model.image1_Delete", "true");
        } else if (imageIndex == 2) {
            params.put("model.image2_Delete", "true");
        } else if (imageIndex == 3) {
            params.put("model.image3_Delete", "true");
        }

        return APIWrapper.postWithToken(URL, params, callback);
    }

    /**
     * 向服务器 注册个推CID
     * @param cid 个推CID
     */
    public static RequestCall registerGetUiCID(
            String cid,
            Callback<String> callback
    ){
        final String URL = ChargeStationURL.format("/other/bindalias.do");
        Map<String, String> params = new HashMap<>();
        params.put("model.cID", cid);
        return APIWrapper.postWithToken(URL, params, callback);
    }

}
